<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const logUser = userOptions => {
      const a = {
        username: 'ZhangSan',
        age: 0,
        sex: 'Male'
      }
      const options = Object.assign(a,userOptions);
      console.log(options);
      return options
    }


    logUser();
    logUser({});
    logUser({username: 'Alex'})

    const p = new Promise((resolve,reject)=>{
      resolve();
      // reject();
    })
    p.then(
      /* ()=>{
        console.log("success");
      }, */
      ()=>{
        console.log("error");
        return new Promise((resolve,reject) => {
          reject("123")
        })
      }
    ).then(
      (data)=>{
        console.log("success1",data);
      },
      (data)=>{
        console.log("error1",data);
      }
    )
    console.log(p);
  </script>
</body>
</html>